echo off

set envPath=..\..\..\makeEnv.cmd

@if not exist %envPath%  goto makeEnvNotExists
@if exist %envPath% call %envPath% %1 %2

echo *****************************************************
echo Create database %databaseName% ver. 001 from scratch
echo *****************************************************

echo SQLServer is %serverName%; Database is %databaseName%

rem **** Import data using character data type for DBO schema
for %%i in (Users) do call ExportData.cmd %%i -c dbo

goto end

:makeEnvNotExists
@echo Fatal Error. File %envPath% does not exist!
goto end

:invalidLogin
@echo Fatal Error. Invalid Login/Password
goto end

:createDBError
@echo Fatal Error during DB version creation
@wscript.exe db_error.vbs /ErrorMsg:"Fatal Error during DB version creation. DB can not be dropped."
goto end

:createFileGroupsDBError
@echo Fatal Error during DB version creation
@wscript.exe db_error.vbs /ErrorMsg:"Fatal Error during DB version creation. File groups were not createted."
goto end

:enableCDCerror
@echo Fatal Error during DB version creation
@wscript.exe db_error.vbs /ErrorMsg:"Fatal Error during DB version creation. CDC was not enabled for database."
goto end

:enableCDCTableError
@echo Fatal Error during DB version creation
@wscript.exe db_error.vbs /ErrorMsg:"Fatal Error during DB version creation. CDC was not enabled for database tables."
goto end

:createDBStructError
@echo Fatal Error during DB version creation
@wscript.exe db_error.vbs /ErrorMsg:"Fatal Error during DB version creation!!!"
goto end

goto end

:end